/**
 * Created by 帅熠 on 2016/10/22.
 */
(function ($) {
    $.fn.extend({
        "tab": function (title,body) {
            for(i=0;i<title.length;i++){
                title[i].id = i;
                title[i].onclick = function () {
                    show(this.id);
                }
            }
            function show(nowid) {
                for (j = 0; j < title.length; j++) {
                    if (nowid == j) {
                        body[j].style.display = 'block';
                        title[j].style.backgroundColor = 'green';
                        title[j].style.color = 'white';
                    } else {
                        body[j].style.display = 'none';
                        title[j].style.backgroundColor = 'white';
                        title[j].style.color = 'black';
                    }
                }
            }
        }
    });
})(jQuery);

